/*************************************************************************
	> File Name: client.cpp
	> Author: ma6174
	> Mail: ma6174@163.com 
	> Created Time: 2021年12月02日 星期四 22时06分09秒
 ************************************************************************/

#include<iostream>
#include "composite.h"
using namespace std;

int main()
{
	Company* root = new ConcreteCompany("北京总公司");
	root->add(new HRDepartment("总公司人力资源部"));
	root->add(new FinanceDepartment("总公司财务部"));

	Company* comp = new ConcreteCompany("上海华东分公司");
	comp->add(new HRDepartment("华东分公司人力资源部"));
	comp->add(new FinanceDepartment("华东分公司财务部"));
	root->add(comp);

	Company* comp1 = new ConcreteCompany("南京办事处");
	comp1->add(new HRDepartment("南京办事处人力资源部"));
	comp1->add(new FinanceDepartment("南京办事处财务部"));
	comp->add(comp1);

	Company* comp2 = new ConcreteCompany("杭州办事处");
	comp2->add(new HRDepartment("杭州办事处人力资源部"));
	comp2->add(new FinanceDepartment("杭州办事处财务部"));
	comp->add(comp2);

	cout << "结构图如下: " << endl;
	root->display(1);
	cout << endl;
	cout << "======================" << endl;
	cout << endl;

	cout << "职责: " << endl;
	root->lineOfDuty();

	return 0;
}
